home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume26 / shadow / part03 < prev    next >
Encoding:
Text File  |  1991-11-24  |  54.5 KB  |  1,935 lines

  1. Newsgroups: comp.sources.misc
  2. From: jfh@rpp386.Cactus.ORG (John F Haugh II)
  3. Subject:  v26i056:  shadow - Shadow Password Suite, Part03/11
  4. Message-ID: <1991Nov24.184956.20077@sparky.imd.sterling.com>
  5. X-Md4-Signature: 4fbff7b105b98b82e9f080d469350c63
  6. Date: Sun, 24 Nov 1991 18:49:56 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jfh@rpp386.Cactus.ORG (John F Haugh II)
  10. Posting-number: Volume 26, Issue 56
  11. Archive-name: shadow/part03
  12. Environment: UNIX
  13. Supersedes: shadow-2: Volume 06, Issue 22-24
  14.  
  15. #! /bin/sh
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  19. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  20. # Contents:  Makefile chage.c login.5 passwd.1
  21. # Wrapped by kent@sparky on Sun Nov 24 11:03:41 1991
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. echo If this archive is complete, you will see the following message:
  24. echo '          "shar: End of archive 3 (of 11)."'
  25. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'Makefile'\"
  27. else
  28.   echo shar: Extracting \"'Makefile'\" \(16060 characters\)
  29.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  30. X#
  31. X# Copyright 1988,1989,1990,1991, John F. Haugh II
  32. X# All rights reserved.
  33. X#
  34. X# Permission is granted to copy and create derivative works for any
  35. X# non-commercial purpose, provided this copyright notice is preserved
  36. X# in all copies of source code, or included in human readable form
  37. X# and conspicuously displayed on all copies of object code or
  38. X# distribution media.
  39. X#
  40. X#    @(#)Makefile    3.24    13:20:38  - Shadow password system
  41. X#
  42. X#    @(#)Makefile    3.24    13:20:38    11/3/91
  43. X#
  44. XSHELL = /bin/sh
  45. X
  46. X#
  47. X# Set this flag to decide what level of code "get" returns.
  48. X# The base USENET release was release 1.  It is no longer supported.
  49. X# The version with the utilities added was release 2.
  50. X# The version with database-like file access is release 3.
  51. XRELEASE = 3
  52. XGFLAGS = -t -r$(RELEASE)
  53. X
  54. X# Define the directory login is copied to.  BE VERY CAREFUL!!!  BSD and SUN
  55. X# seems to use /bin, USG seems to use /etc.  If you define SCOLOGIN, you
  56. X# MUST use /etc as LOGINDIR.
  57. X# LOGINDIR = /bin
  58. XLOGINDIR = /etc
  59. X
  60. X# Define any special libraries required to access the directory routines.
  61. X# NDIR = -lndir
  62. XNDIR = -lx
  63. X
  64. X# Pick your favorite C compiler and tags command
  65. XCC = cc
  66. XTAGS = ctags
  67. X
  68. X# OS.  Pick one of USG (AT&T, SYSV, SYS3), BSD, or SUN.
  69. XOS = -DUSG
  70. X# OS = -DBSD
  71. X# OS = -DSUN
  72. X
  73. X# Do you have to do ranlib?  Sorry to hear that ...
  74. XRANLIB = ranlib
  75. X# RANLIB = echo
  76. X
  77. X# Enable the following if you are running SCO TCP/IP.  It is a /bin/login
  78. X# which understands the *ahem* novel way they do rlogin/telnet.
  79. X# SCOLOGIN = scologin
  80. X
  81. X# Configuration Flags
  82. X#
  83. X#    LIBS - system libraries
  84. X#        -lsocket - needed for TCP/IP and possibly SYSLOG
  85. X#        -ldbm or -lndbm - needed for DBM support
  86. X#        -lcrypt - needed for SCO crypt() functions
  87. X#    CFLAGS - C compiler flags
  88. X#        -DLAI_TCP - needed for SCO Xenix Lachman TCP/IP
  89. X
  90. X# Flags for SCO Xenix/386
  91. XCFLAGS = -O -M3 -g $(OS)
  92. XLIBS = -lcrypt -lndbm
  93. X# LIBS = -lcrypt -ldbm
  94. XLDFLAGS = -M3 -g
  95. XLTFLAGS = 
  96. X# This should be Slibsec.a for small model, or Llibsec.a for
  97. X# large model or whatever.  MUST AGREE WITH CFLAGS!!!
  98. XLIBSEC = Slibsec.a
  99. X
  100. X# Flags for normal machines
  101. X# CFLAGS = -O -g $(OS)
  102. X# LIBS =
  103. X# LDFLAGS = -g
  104. X# LIBSEC = libsec.a
  105. X
  106. X# Names for root user and group, and bin user and group.  See your
  107. X# /etc/passwd and /etc/group files.
  108. XRUID = root
  109. XRGID = root
  110. X# RGID = wheel
  111. XBUID = bin
  112. XBGID = bin
  113. X
  114. X# Rules for .L (lint) files.
  115. X.SUFFIXES: .L
  116. XLINT = lint
  117. XLINTFLAGS = $(OS) -Dlint
  118. X
  119. X.c.L:
  120. X    $(LINT) -pxu $(LINTFLAGS) $*.c > $*.L
  121. X
  122. XLOBJS = lmain.o login.o env.o valid.o setup.o shell.o age.o \
  123. X    utmp.o sub.o mail.o motd.o log.o ttytype.o failure.o \
  124. X    tz.o console.o hushed.o
  125. X
  126. XLSRCS = lmain.c login.c env.c valid.c setup.c shell.c age.c \
  127. X    utmp.c sub.c mail.c motd.c log.c ttytype.c failure.c \
  128. X    tz.c console.c hushed.c
  129. X
  130. XSOBJS = smain.o env.o entry.o susetup.o shell.o \
  131. X    sub.o mail.o motd.o sulog.o age.o tz.o hushed.o
  132. X
  133. XSSRCS = smain.c env.c entry.c setup.c shell.c \
  134. X    pwent.c sub.c mail.c motd.c sulog.c shadow.c age.c pwpack.c rad64.c \
  135. X    tz.c hushed.c
  136. X
  137. XPOBJS = passwd.o obscure.o
  138. XPSRCS = passwd.c obscure.c
  139. X
  140. XGPSRCS = gpmain.c
  141. X
  142. XGPOBJS = gpmain.o
  143. X
  144. XPWOBJS = pwconv.o
  145. X
  146. XPWSRCS = pwconv.c pwent.c shadow.c pwpack.c rad64.c
  147. X
  148. XPWUNOBJS = pwunconv.o
  149. X
  150. XPWUNSRCS = pwunconv.c pwent.c shadow.c pwpack.c rad64.c
  151. X
  152. XSULOGOBJS = sulogin.o entry.o env.o age.o setup.o \
  153. X    valid.o shell.o tz.o
  154. X
  155. XSULOGSRCS = sulogin.c entry.c env.c age.c pwent.c setup.c \
  156. X    shadow.c shell.c valid.c pwpack.c tz.c
  157. X
  158. XMKPWDOBJS = mkpasswd.o
  159. X
  160. XMKPWDSRCS = mkpasswd.c
  161. X
  162. XNGSRCS = newgrp.c env.c shell.c
  163. X
  164. XNGOBJS = newgrp.o env.o shell.o
  165. X
  166. XCHFNSRCS = chfn.c fields.c
  167. XCHFNOBJS = chfn.o fields.o
  168. XCHSHSRCS = chsh.c fields.c
  169. XCHSHOBJS = chsh.o fields.o
  170. XCHAGEOBJS = chage.o fields.o
  171. XCHAGESRCS = chage.c fields.c
  172. XCHPASSOBJS = chpasswd.o
  173. XCHPASSSRCS = chpasswd.c
  174. XDPSRCS = dpmain.c
  175. XDPOBJS = dpmain.o
  176. X
  177. XALLSRCS = age.c dialchk.c dialup.c entry.c env.c lmain.c log.c login.c mail.c \
  178. X    motd.c obscure.c passwd.c pwconv.c pwent.c pwunconv.c getpass.c \
  179. X    setup.c shadow.c shell.c smain.c sub.c sulog.c sulogin.c ttytype.c \
  180. X    utmp.c valid.c port.c newgrp.c gpmain.c grent.c mkpasswd.c pwpack.c \
  181. X    chfn.c chsh.c chage.c rad64.c encrypt.c chpasswd.c shadowio.c pwio.c \
  182. X    newusers.c groupio.c fields.c pwdbm.c grpack.c grdbm.c sppack.c \
  183. X    spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c useradd.c \
  184. X    userdel.c patchlevel.h usermod.c copydir.c mkrmdir.c groupadd.c \
  185. X    groupdel.c groupmod.c tz.c console.c hushed.c getdef.c scologin.c \
  186. X    logoutd.c groups.c
  187. X
  188. XFILES1 = README patchlevel.h newgrp.c Makefile config.h pwunconv.c obscure.c \
  189. X    age.c id.c
  190. X
  191. XFILES2 = passwd.c port.c lmain.c sulogin.c pwpack.c dialup.c
  192. X
  193. XFILES3 = chfn.c chsh.c smain.c faillog.c pwconv.c shadow.c
  194. X
  195. XFILES4 = gpmain.c chage.c pwent.c valid.c setup.c entry.c ttytype.c port.h
  196. X
  197. XFILES5 = pwio.c encrypt.c chpasswd.c newusers.c rad64.c dialchk.c faillog.h \
  198. X    pwdbm.c grdbm.c gshadow.c sppack.c
  199. X
  200. XFILES6 = gspack.c spdbm.c lastlog.h shell.c login.c sub.c dpmain.c mail.c \
  201. X    env.c pwd.h.m4 grpack.c shadow.h log.c grent.c motd.c dialup.h \
  202. X    fields.c gsdbm.c utmp.c failure.c
  203. X
  204. XFILES7 = groupio.c shadowio.c sgroupio.c groups.c copydir.c mkrmdir.c \
  205. X    mkpasswd.c
  206. X
  207. XFILES8 = useradd.c usermod.c
  208. X
  209. XFILES9 = groupadd.c groupdel.c groupmod.c tz.c console.c hushed.c getdef.c \
  210. X    scologin.c logoutd.c sulog.c getpass.c userdel.c
  211. X
  212. XMAN_1 = chage.1 chfn.1 chsh.1 id.1 login.1 newgrp.1 passwd.1 su.1 \
  213. X    useradd.1 userdel.1 usermod.1 groupadd.1 groupdel.1 groupmod.1 \
  214. X    groups.1
  215. XMAN_3 = shadow.3
  216. XMAN_4 = faillog.4 passwd.4 porttime.4 shadow.4
  217. XMAN_5 = login.5
  218. XMAN_8 = chpasswd.8 dpasswd.8 faillog.8 newusers.8 pwconv.8 pwunconv.8 \
  219. X    sulogin.8 mkpasswd.8 logoutd.8
  220. X
  221. XDOCS1 = $(MAN_1) $(MAN_3) $(MAN_4)
  222. XDOCS2 = $(MAN_5) $(MAN_8)
  223. XDOCS = $(DOCS1) $(DOCS2)
  224. X
  225. XBINS = su login pwconv pwunconv passwd sulogin faillog newgrp gpasswd \
  226. X    mkpasswd chfn chsh chage chpasswd newusers dpasswd id useradd \
  227. X    userdel usermod groupadd groupdel groupmod $(SCOLOGIN) logoutd \
  228. X    groups
  229. X
  230. Xall:    $(BINS) $(DOCS)
  231. X
  232. X.PRECIOUS: libshadow.a
  233. X
  234. Xlibshadow.a: \
  235. X    libshadow.a(dialchk.o) \
  236. X    libshadow.a(dialup.o) \
  237. X    libshadow.a(encrypt.o) \
  238. X    libshadow.a(getdef.o) \
  239. X    libshadow.a(getpass.o) \
  240. X    libshadow.a(grdbm.o) \
  241. X    libshadow.a(grent.o) \
  242. X    libshadow.a(groupio.o) \
  243. X    libshadow.a(grpack.o) \
  244. X    libshadow.a(gshadow.o) \
  245. X    libshadow.a(gsdbm.o) \
  246. X    libshadow.a(gspack.o) \
  247. X    libshadow.a(sgroupio.o) \
  248. X    libshadow.a(port.o) \
  249. X    libshadow.a(pwdbm.o) \
  250. X    libshadow.a(pwent.o) \
  251. X    libshadow.a(pwio.o) \
  252. X    libshadow.a(pwpack.o) \
  253. X    libshadow.a(rad64.o) \
  254. X    libshadow.a(spdbm.o) \
  255. X    libshadow.a(shadow.o) \
  256. X    libshadow.a(shadowio.o) \
  257. X    libshadow.a(sppack.o)
  258. X    $(RANLIB) libshadow.a
  259. X
  260. Xlibsec: $(LIBSEC)(shadow.o)
  261. X    $(RANLIB) $(LIBSEC)
  262. X
  263. Xinstall: all
  264. X    strip $(BINS)
  265. X    cp login $(LOGINDIR)/login
  266. X    cp mkpasswd pwconv pwunconv sulogin chpasswd newusers \
  267. X        useradd userdel usermod groupadd groupdel groupmod logoutd /etc
  268. X    cp su passwd gpasswd dpasswd faillog newgrp chfn chsh chage id /bin
  269. X    cp dialup.h shadow.h pwd.h /usr/include
  270. X    chown $(RUID) $(LOGINDIR)/login /etc/pwconv /etc/pwunconv /etc/sulogin \
  271. X        /bin/su /bin/passwd /bin/gpasswd /bin/newgrp /etc/mkpasswd \
  272. X        /bin/dpasswd /bin/chsh /bin/chfn /bin/chage /etc/useradd \
  273. X        /etc/userdel /etc/usermod /etc/groupadd /etc/groupdel \
  274. X        /etc/groupmod /etc/logoutd
  275. X    chgrp $(RGID) $(LOGINDIR)/login /etc/pwconv /etc/pwunconv /etc/sulogin \
  276. X        /bin/su /bin/passwd /bin/gpasswd /bin/newgrp /etc/mkpasswd \
  277. X        /bin/dpasswd /bin/chsh /bin/chfn /bin/chage /etc/useradd \
  278. X        /etc/userdel /etc/usermod /etc/groupadd /etc/groupdel \
  279. X        /etc/groupmod /etc/logoutd
  280. X    chown $(BUID) /bin/faillog /bin/id /usr/include/shadow.h \
  281. X        /usr/include/dialup.h /usr/include/pwd.h
  282. X    chgrp $(BGID) /bin/faillog /bin/id /usr/include/shadow.h \
  283. X        /usr/include/dialup.h /usr/include/pwd.h
  284. X    chmod 700 /etc/pwconv /etc/pwunconv /etc/sulogin /etc/mkpasswd \
  285. X        /etc/chpasswd /etc/newusers /bin/dpasswd /bin/chage \
  286. X        /etc/useradd /etc/userdel /etc/usermod /etc/groupadd \
  287. X        /etc/groupdel /etc/groupmod /etc/logoutd
  288. X    chmod 4711 $(LOGINDIR)/login /bin/su /bin/passwd /bin/gpasswd \
  289. X        /bin/newgrp /bin/chfn /bin/chsh
  290. X    chmod 711 /bin/faillog /bin/id
  291. X    chmod 444 /usr/include/shadow.h /usr/include/dialup.h \
  292. X        /usr/include/pwd.h
  293. X    [ -f /etc/login.defs ] || (cp login.defs /etc ; \
  294. X        chown $(RUID) /etc/login.defs ; \
  295. X        chgrp $(RGID) /etc/login.defs ; \
  296. X        chmod 600 /etc/login.defs )
  297. X    [ -z "$(SCOLOGIN)" ] || (cp scologin /bin/login ; \
  298. X        chown $(RUID) /bin/login ; \
  299. X        chgrp $(RGID) /bin/login ; \
  300. X        chmod 755 /bin/login )
  301. X
  302. Xlint:    su.lint login.lint pwconv.lint pwunconv.lint passwd.lint sulogin.lint \
  303. X    faillog.lint newgrp.lint gpasswd.lint mkpasswd.lint chfn.lint \
  304. X    chsh.lint chage.lint dpasswd.lint id.lint useradd.lint userdel.lint \
  305. X    usermod.lint groupadd.lint groupdel.lint groupmod.lint $(ALLSRCS:.c=.L)
  306. X    logoutd.lint
  307. X
  308. Xtags:    $(ALLSRCS)
  309. X    $(TAGS) $(ALLSRCS)
  310. X
  311. XREADME:
  312. X    [ -f s.README ] && get -t -r$(RELEASE) s.README
  313. X    
  314. X$(DOCS):
  315. X    [ -f s.$@ ] && get -t -r$(RELEASE) s.$@
  316. X
  317. Xlogin:    $(LOBJS) libshadow.a
  318. X    $(CC) -o login $(LDFLAGS) $(LOBJS) libshadow.a $(LIBS)
  319. X
  320. Xlogin.lint: $(LSRCS)
  321. X    $(LINT) $(LINTFLAGS) $(LSRCS) > login.lint
  322. X
  323. Xsu:    $(SOBJS) libshadow.a
  324. X    $(CC) -o su $(LDFLAGS) $(SOBJS) libshadow.a $(LIBS)
  325. X
  326. Xsu.lint:    $(SSRCS)
  327. X    $(LINT) $(LINTFLAGS) -DSU $(SSRCS) > su.lint
  328. X
  329. Xpasswd:    $(POBJS) libshadow.a
  330. X    $(CC) -o passwd $(LDFLAGS) $(POBJS) libshadow.a $(LIBS)
  331. X
  332. Xpasswd.lint: $(PSRCS)
  333. X    $(LINT) $(LINTFLAGS) -DPASSWD $(PSRCS) > passwd.lint
  334. X
  335. Xgpasswd: $(GPOBJS) libshadow.a
  336. X    $(CC) -o gpasswd $(LDFLAGS) $(GPOBJS) libshadow.a $(LIBS)
  337. X
  338. Xgpasswd.lint: $(GPSRCS)
  339. X    $(LINT) $(LINTFLAGS) $(GPSRCS) > gpasswd.lint
  340. X
  341. Xdpasswd: $(DPOBJS) libshadow.a
  342. X    $(CC) -o dpasswd $(LDFLAGS) $(DPOBJS) libshadow.a $(LIBS)
  343. X
  344. Xdpasswd.lint: $(DPSRCS)
  345. X    $(LINT) $(LINTFLAGS) $(DPSRCS) > dpasswd.lint
  346. X
  347. Xpwconv:    $(PWOBJS) libshadow.a config.h
  348. X    $(CC) -o pwconv $(LDFLAGS) $(PWOBJS) libshadow.a $(LIBS)
  349. X
  350. Xpwconv.lint: $(PWSRCS) config.h
  351. X    $(LINT) $(LINTFLAGS) -DPASSWD $(PWSRCS) > pwconv.lint
  352. X
  353. Xpwunconv: $(PWUNOBJS) libshadow.a config.h
  354. X    $(CC) -o pwunconv $(LDFLAGS) $(PWUNOBJS) libshadow.a $(LIBS)
  355. X
  356. Xpwunconv.lint: $(PWUNSRCS)
  357. X    $(LINT) $(LINTFLAGS) -DPASSWD $(PWUNSRCS) > pwunconv.lint
  358. X
  359. Xsulogin: $(SULOGOBJS) libshadow.a
  360. X    $(CC) -o sulogin $(LDFLAGS) $(SULOGOBJS) libshadow.a $(LIBS)
  361. X
  362. Xsulogin.lint: $(SULOGSRCS)
  363. X    $(LINT) $(LINTFLAGS) $(SULOGSRCS) > sulogin.lint
  364. X
  365. Xfaillog: faillog.o
  366. X    $(CC) -o faillog $(LDFLAGS) faillog.o $(LIBS)
  367. X
  368. Xfaillog.lint: faillog.c faillog.h config.h
  369. X    $(LINT) $(LINTFLAGS) faillog.c > faillog.lint
  370. X
  371. Xmkpasswd: $(MKPWDOBJS) libshadow.a
  372. X    $(CC) -o mkpasswd $(LDFLAGS) $(MKPWDOBJS) libshadow.a $(LIBS)
  373. X
  374. Xmkpasswd.lint: $(MKPWDSRCS)
  375. X    $(LINT) $(LINTFLAGS) $(MKPWDSRCS) > mkpasswd.lint
  376. X
  377. Xnewgrp: $(NGOBJS) libshadow.a
  378. X    $(CC) -o newgrp $(LDFLAGS) $(NGOBJS) libshadow.a $(LIBS)
  379. X
  380. Xnewgrp.lint: $(NGSRCS)
  381. X    $(LINT) $(LINTFLAGS) $(NGSRCS) > newgrp.lint
  382. X
  383. Xchfn:    $(CHFNOBJS) libshadow.a
  384. X    $(CC) -o chfn $(LDFLAGS) $(CHFNOBJS) libshadow.a $(LIBS)
  385. X
  386. Xchfn.lint:    $(CHFNSRCS)
  387. X    $(LINT) $(LINTFLAGS) $(CHFNSRCS) > chfn.lint
  388. X
  389. Xchsh:    $(CHSHOBJS) libshadow.a
  390. X    $(CC) -o chsh $(LDFLAGS) $(CHSHOBJS) libshadow.a $(LIBS)
  391. X
  392. Xchsh.lint: $(CHSHSRCS)
  393. X    $(LINT) $(LINTFLAGS) $(CHSHSRCS) > chsh.lint
  394. X
  395. Xchage:    $(CHAGEOBJS) libshadow.a
  396. X    $(CC) -o chage $(LDFLAGS) $(CHAGEOBJS) libshadow.a $(LIBS)
  397. X
  398. Xchage.lint: $(CHAGESRCS)
  399. X    $(LINT) $(LINTFLAGS) -DPASSWD $(CHAGESRCS) > chage.lint
  400. X
  401. Xchpasswd: $(CHPASSOBJS) libshadow.a
  402. X    $(CC) -o chpasswd $(LDFLAGS) $(CHPASSOBJS) libshadow.a $(LIBS)
  403. X
  404. Xchpasswd.lint: $(CHPASSSRCS)
  405. X    $(LINT) $(LINTFLAGS) $(CHPASSSRCS) > chpasswd.lint
  406. X
  407. Xnewusers: newusers.o libshadow.a
  408. X    $(CC) -o newusers $(LDFLAGS) newusers.o libshadow.a $(LIBS)
  409. X
  410. Xnewusers.lint: newusers.c
  411. X    $(LINT) $(LINTFLAGS) newusers.c > newusers.lint
  412. X    
  413. Xid: id.o libshadow.a
  414. X    $(CC) -o id $(LDFLAGS) id.o libshadow.a $(LIBS)
  415. X
  416. Xid.lint: id.c
  417. X    $(LINT) $(LINTFLAGS) id.c > id.lint
  418. X
  419. Xgroups: groups.o libshadow.a
  420. X    $(CC) -c $(CFLAGS) groups.o libshadow.a $(LIBS)
  421. X
  422. Xgroups.lint: groups.c
  423. X    $(LINT) $(LINTFLAGS) groups.c > groups.lint
  424. X
  425. Xuseradd: useradd.o copydir.o mkrmdir.o libshadow.a
  426. X    $(CC) -o useradd $(LDFLAGS) useradd.o copydir.o mkrmdir.o \
  427. X        libshadow.a $(LIBS) $(NDIR)
  428. X
  429. Xuseradd.lint: useradd.c copydir.c mkrmdir.c
  430. X    $(LINT) $(LINTFLAGS) useradd.c copydir.c mkrmdir.c > useradd.lint
  431. X
  432. Xuserdel: userdel.o copydir.o mkrmdir.o libshadow.a
  433. X    $(CC) -o userdel $(LDFLAGS) userdel.o copydir.o mkrmdir.o \
  434. X        libshadow.a $(LIBS) $(NDIR)
  435. X
  436. Xuserdel.lint: userdel.c copydir.c mkrmdir.c
  437. X    $(LINT) $(LINTFLAGS) userdel.c copydir.c mkrmdir.c > userdel.lint
  438. X
  439. Xusermod: usermod.o copydir.o mkrmdir.o libshadow.a
  440. X    $(CC) -o usermod $(LDFLAGS) usermod.o copydir.o mkrmdir.o \
  441. X        libshadow.a $(LIBS) $(NDIR)
  442. X
  443. Xusermod.lint: usermod.c copydir.c mkrmdir.c
  444. X    $(LINT) $(LINTFLAGS) usermod.c copydir.c mkrmdir.c > usermod.lint
  445. X
  446. Xgroupadd: groupadd.o libshadow.a
  447. X    $(CC) -o groupadd $(LDFLAGS) groupadd.o libshadow.a $(LIBS)
  448. X
  449. Xgroupadd.lint: groupadd.c
  450. X    $(LINT) $(LINTFLAGS) groupadd.c > groupadd.lint
  451. X
  452. Xgroupdel: groupdel.o libshadow.a
  453. X    $(CC) -o groupdel $(LDFLAGS) groupdel.o libshadow.a $(LIBS)
  454. X
  455. Xgroupdel.lint: groupdel.c
  456. X    $(LINT) $(LINTFLAGS) groupdel.c > groupdel.lint
  457. X
  458. Xgroupmod: groupmod.o libshadow.a
  459. X    $(CC) -o groupmod $(LDFLAGS) groupmod.o libshadow.a $(LIBS)
  460. X
  461. Xgroupmod.lint: groupmod.c
  462. X    $(LINT) $(LINTFLAGS) groupmod.c > groupmod.lint
  463. X
  464. Xpwd.h.m4:
  465. X    [ -f s.pwd.h.m4 ] && get -t -r$(RELEASE) s.pwd.h.m4
  466. X
  467. Xpwd.h: pwd.h.m4
  468. X    m4 $(OS) pwd.h.m4 >pwd.h
  469. X
  470. Xlogoutd: logoutd.o libshadow.a
  471. X    $(CC) -o logoutd $(LDFLAGS) logoutd.o libshadow.a
  472. X
  473. Xlogoutd.lint: logoutd.c
  474. X    $(LINT) $(LINTFLAGS) logoutd.c > logoutd.lint
  475. X
  476. Xsulog.o: config.h
  477. X
  478. Xsusetup.c: setup.c
  479. X    cp setup.c susetup.c
  480. X
  481. Xsusetup.o: config.h setup.c pwd.h
  482. X    $(CC) -c $(CFLAGS) -DSU susetup.c
  483. X
  484. Xscologin: scologin.o
  485. X    $(CC) -o scologin $(LDFLAGS) scologin.o -lsocket
  486. X
  487. Xpasswd.o: config.h shadow.h pwd.h
  488. Xlmain.o: config.h lastlog.h faillog.h pwd.h
  489. Xsmain.o: config.h lastlog.h pwd.h shadow.h
  490. Xsub.o: pwd.h
  491. Xsetup.o: config.h pwd.h
  492. Xmkrmdir.o: config.h
  493. Xutmp.o: config.h
  494. Xmail.o: config.h
  495. Xmotd.o: config.h
  496. Xage.o: config.h pwd.h
  497. Xlog.o: config.h lastlog.h pwd.h
  498. Xshell.o: config.h
  499. Xentry.o: config.h shadow.h pwd.h
  500. Xhushed.o: config.h pwd.h
  501. Xvalid.o: config.h pwd.h
  502. Xfailure.o: faillog.h config.h
  503. Xfaillog.o: faillog.h config.h pwd.h
  504. Xnewgrp.o: config.h shadow.h pwd.h
  505. Xmkpasswd.o: config.h shadow.h pwd.h
  506. Xgpmain.o: config.h pwd.h
  507. Xchfn.o: config.h pwd.h
  508. Xchsh.o: config.h pwd.h
  509. Xchage.o: config.h shadow.h pwd.h
  510. Xpwconv.o: config.h shadow.h
  511. Xpwunconv.o: config.h shadow.h pwd.h
  512. Xchpasswd.o: config.h shadow.h pwd.h
  513. Xid.o: pwd.h
  514. Xnewusers.o: config.h shadow.h pwd.h
  515. Xdpmain.o: dialup.h
  516. Xuseradd.o: config.h shadow.h pwd.h
  517. Xuserdel.o: config.h shadow.h pwd.h
  518. Xusermod.o: config.h shadow.h pwd.h
  519. Xgroupadd.o: config.h shadow.h
  520. Xgroupdel.o: config.h shadow.h
  521. Xgroupmod.o: config.h shadow.h
  522. Xlogoutd.o:
  523. X
  524. Xlibshadow.a(shadow.o): shadow.h config.h
  525. Xlibshadow.a(shadowio.o): shadow.h
  526. Xlibshadow.a(grent.o): config.h shadow.h
  527. Xlibshadow.a(sgroupio.o): shadow.h
  528. Xlibshadow.a(dialup.o): dialup.h
  529. Xlibshadow.a(dialchk.o): dialup.h config.h
  530. Xlibshadow.a(getdef.o): config.h
  531. Xlibshadow.a(pwdbm.o): config.h pwd.h
  532. Xlibshadow.a(pwpack.o): config.h pwd.h
  533. Xlibshadow.a(pwent.o): config.h pwd.h
  534. Xlibshadow.a(pwio.o): pwd.h
  535. Xlibshadow.a(getpass.o): config.h
  536. Xlibshadow.a(encrypt.o): config.h
  537. Xlibshadow.a(port.o): port.h
  538. X
  539. Xclean:
  540. X    -rm -f susetup.c *.o a.out core npasswd nshadow *.pag *.dir
  541. X
  542. Xclobber: clean
  543. X    -rm -f $(BINS) *.lint *.L libshadow.a
  544. X
  545. Xnuke:    clobber
  546. X    -for file in * ; do \
  547. X        if [ -f s.$$file -a ! -f p.$$file ] ; then \
  548. X            rm -f $$file ;\
  549. X        fi ;\
  550. X    done
  551. X
  552. Xshar:    login.sh.01 login.sh.02 login.sh.03 login.sh.04 login.sh.05 \
  553. X    login.sh.06 login.sh.07 login.sh.08 login.sh.09 login.sh.10 \
  554. X    login.sh.11
  555. X
  556. Xlogin.sh.01: $(FILES1) Makefile
  557. X    shar -a $(FILES1) > login.sh.01
  558. X
  559. Xlogin.sh.02: $(FILES2) Makefile
  560. X    shar -a $(FILES2) > login.sh.02
  561. X
  562. Xlogin.sh.03: $(FILES3) Makefile
  563. X    shar -a $(FILES3) > login.sh.03
  564. X
  565. Xlogin.sh.04: $(FILES4) Makefile
  566. X    shar -a $(FILES4) > login.sh.04
  567. X
  568. Xlogin.sh.05: $(FILES5) Makefile
  569. X    shar -a $(FILES5) > login.sh.05
  570. X
  571. Xlogin.sh.06: $(FILES6) Makefile
  572. X    shar -a $(FILES6) > login.sh.06
  573. X
  574. Xlogin.sh.07: $(FILES7) Makefile
  575. X    shar -a $(FILES7) > login.sh.07
  576. X
  577. Xlogin.sh.08: $(FILES8) Makefile
  578. X    shar -a $(FILES8) > login.sh.08
  579. X
  580. Xlogin.sh.09: $(FILES9) Makefile
  581. X    shar -a $(FILES9) > login.sh.09
  582. X
  583. Xlogin.sh.10: $(DOCS1) Makefile
  584. X    shar -a $(DOCS1) > login.sh.10
  585. X
  586. Xlogin.sh.11: $(DOCS2) Makefile
  587. X    shar -a $(DOCS2) > login.sh.11
  588. END_OF_FILE
  589.   if test 16060 -ne `wc -c <'Makefile'`; then
  590.     echo shar: \"'Makefile'\" unpacked with wrong size!
  591.   fi
  592.   # end of 'Makefile'
  593. fi
  594. if test -f 'chage.c' -a "${1}" != "-c" ; then 
  595.   echo shar: Will not clobber existing file \"'chage.c'\"
  596. else
  597.   echo shar: Extracting \"'chage.c'\" \(17397 characters\)
  598.   sed "s/^X//" >'chage.c' <<'END_OF_FILE'
  599. X/*
  600. X * Copyright 1989, 1990, 1991, John F. Haugh II
  601. X * All rights reserved.
  602. X *
  603. X * Permission is granted to copy and create derivative works for any
  604. X * non-commercial purpose, provided this copyright notice is preserved
  605. X * in all copies of source code, or included in human readable form
  606. X * and conspicuously displayed on all copies of object code or
  607. X * distribution media.
  608. X */
  609. X
  610. X#include <sys/types.h>
  611. X#include <stdio.h>
  612. X#include <fcntl.h>
  613. X#include <signal.h>
  614. X#include <ctype.h>
  615. X#include <time.h>
  616. X
  617. X#ifndef    lint
  618. Xstatic    char    sccsid[] = "@(#)chage.c    3.9    10:14:30    8/15/91";
  619. X#endif
  620. X
  621. X/*
  622. X * Set up some BSD defines so that all the BSD ifdef's are
  623. X * kept right here 
  624. X */
  625. X
  626. X#ifndef    BSD
  627. X#include <string.h>
  628. X#include <memory.h>
  629. X#define    bzero(a,n)    memset(a, 0, n)
  630. X#else
  631. X#include <strings.h>
  632. X#define    strchr    index
  633. X#define    strrchr    rindex
  634. X#endif
  635. X
  636. X#include "config.h"
  637. X#include "pwd.h"
  638. X#include "shadow.h"
  639. X
  640. X#ifdef    USE_SYSLOG
  641. X#include <syslog.h>
  642. X
  643. X#ifndef    LOG_WARN
  644. X#define    LOG_WARN LOG_WARNING
  645. X#endif    /* !LOG_WARN */
  646. X#endif    /* USE_SYSLOG */
  647. X
  648. X/*
  649. X * Global variables
  650. X */
  651. X
  652. Xchar    *Prog;
  653. Xlong    mindays;
  654. Xlong    maxdays;
  655. Xlong    lastday;
  656. Xlong    warndays;
  657. Xlong    inactdays;
  658. Xlong    expdays;
  659. Xvoid    cleanup();
  660. X
  661. X/*
  662. X * External identifiers
  663. X */
  664. X
  665. Xextern    long    a64l();
  666. Xextern    int    pw_lock(), pw_open(),
  667. X        pw_unlock(), pw_close(),
  668. X        pw_update();
  669. Xextern    struct    passwd    *pw_locate();
  670. Xextern    int    spw_lock(), spw_open(),
  671. X        spw_unlock(), spw_close(),
  672. X        spw_update();
  673. Xextern    struct    spwd    *spw_locate();
  674. Xextern    int    optind;
  675. Xextern    char    *optarg;
  676. Xextern    char    *getlogin ();
  677. X#ifdef    NDBM
  678. Xextern    int    pw_dbm_mode;
  679. Xextern    int    sp_dbm_mode;
  680. X#endif
  681. X
  682. X/*
  683. X * Password aging constants
  684. X *
  685. X *    DAY - seconds in a day
  686. X *    WEEK - seconds in a week
  687. X *    SCALE - convert from clock to aging units
  688. X */
  689. X
  690. X#define    DAY    (24L*3600L)
  691. X#define    WEEK    (7*DAY)
  692. X
  693. X#ifdef    ITI_AGING
  694. X#define    SCALE    (1)
  695. X#else
  696. X#define    SCALE    (DAY)
  697. X#endif
  698. X
  699. X/*
  700. X * days and juldays are used to compute the number of days in the
  701. X * current month, and the cummulative number of days in the preceding
  702. X * months.  they are declared so that january is 1, not 0.
  703. X */
  704. X
  705. Xstatic    short    days[13] = { 0,
  706. X    31,    28,    31,    30,    31,    30,    /* JAN - JUN */
  707. X    31,    31,    30,    31,    30,    31 };    /* JUL - DEC */
  708. X
  709. Xstatic    short    juldays[13] = { 0,
  710. X    0,    31,    59,    90,    120,    151,    /* JAN - JUN */
  711. X    181,    212,    243,    273,    304,    334 };    /* JUL - DEC */
  712. X
  713. X/*
  714. X * #defines for messages.  This facilities foreign language conversion
  715. X * since all messages are defined right here.
  716. X */
  717. X
  718. X#define    USAGE \
  719. X"Usage: %s [ -l ] [ -m min_days ] [ -M max_days ] [ -W warn ]\n\
  720. X       [ -I inactive ] [ -E expire ] [ -d last_day ] user\n"
  721. X#define    DBMERROR    "Error updating the DBM password entry.\n"
  722. X#define    DBMERROR2    "error updating DBM shadow entry.\n"
  723. X#define    UNK_USER    "%s: unknown user: %s\n"
  724. X#define    NO_LFLAG    "%s: do no include \"l\" with other flags\n"
  725. X#define    NO_PERM        "%s: permission denied\n"
  726. X#define    NO_PWLOCK    "%s: can't lock password file\n"
  727. X#define    NO_SPLOCK    "%s: can't lock shadow password file\n"
  728. X#define    NO_PWOPEN    "%s: can't open password file\n"
  729. X#define    NO_SPOPEN    "%s: can't open shadow password file\n"
  730. X#define    CHANGE_INFO    "Changing the aging information for %s\n"
  731. X#define    FIELD_ERR    "%s: error changing fields\n"
  732. X#define    NO_PWUPDATE    "%s: can't update password file\n"
  733. X#define    NO_SPUPDATE    "%s: can't update shadow password file\n"
  734. X#define    NO_PWCLOSE    "%s: can't rewrite password file\n"
  735. X#define    NO_SPCLOSE    "%s: can't rewrite shadow password file\n"
  736. X#define    LOCK_FAIL    "failed locking %s\n"
  737. X#define    OPEN_FAIL    "failed opening %s\n"
  738. X#define    WRITE_FAIL    "failed updating %s\n"
  739. X#define    CLOSE_FAIL    "failed rewriting %s\n"
  740. X
  741. X/*
  742. X * usage - print command line syntax and exit
  743. X */
  744. X
  745. Xvoid
  746. Xusage ()
  747. X{
  748. X    fprintf (stderr, USAGE, Prog);
  749. X    exit (1);
  750. X}
  751. X
  752. X/*
  753. X * strtoday - compute the number of days since 1970.
  754. X *
  755. X * the total number of days prior to the current date is
  756. X * computed.  january 1, 1970 is used as the origin with
  757. X * it having a day number of 0.  the gmtime() routine is
  758. X * used to prevent confusion regarding time zones.
  759. X */
  760. X
  761. Xlong
  762. Xstrtoday (str)
  763. Xchar    *str;
  764. X{
  765. X    char    slop[2];
  766. X    int    month;
  767. X    int    day;
  768. X    int    year;
  769. X    long    total;
  770. X
  771. X    /*
  772. X     * start by separating the month, day and year.  this is
  773. X     * a chauvanistic program - it only takes date input in
  774. X     * the standard USA format.
  775. X     */
  776. X
  777. X    if (sscanf (str, "%d/%d/%d%c", &month, &day, &year, slop) != 3)
  778. X        return -1;
  779. X
  780. X    /*
  781. X     * the month, day of the month, and year are checked for
  782. X     * correctness and the year adjusted so it falls between
  783. X     * 1970 and 2069.
  784. X     */
  785. X
  786. X    if (month < 1 || month > 12)
  787. X        return -1;
  788. X
  789. X    if (day < 1)
  790. X        return -1;
  791. X
  792. X    if ((month != 2 || (year % 4) != 0) && day > days[month])
  793. X        return -1;
  794. X    else if ((month == 2 && (year % 4) == 0) && day > 29)
  795. X        return -1;
  796. X
  797. X    if (year < 0)
  798. X        return -1;
  799. X    else if (year < 69)
  800. X        year += 2000;
  801. X    else if (year < 99)
  802. X        year += 1900;
  803. X
  804. X    if (year < 1970 || year > 2069)
  805. X        return -1;
  806. X
  807. X    /*
  808. X     * the total number of days is the total number of days in all
  809. X     * the whole years, plus the number of leap days, plus the
  810. X     * number of days in the whole months preceding, plus the number
  811. X     * of days so far in the month.
  812. X     */
  813. X
  814. X    total = ((year - 1970) * 365) + (((year + 1) - 1970) / 4);
  815. X    total += juldays[month] + (month > 2 && (year % 4) == 0 ? 1:0);
  816. X    total += day - 1;
  817. X
  818. X    return total;
  819. X}
  820. X
  821. X/*
  822. X * new_fields - change the user's password aging information interactively.
  823. X *
  824. X * prompt the user for all of the password age values.  set the fields
  825. X * from the user's response, or leave alone if nothing was entered.  the
  826. X * value (-1) is used to indicate the field should be removed if possible.
  827. X * any other negative value is an error.  very large positive values will
  828. X * be handled elsewhere.
  829. X */
  830. X
  831. Xint
  832. Xnew_fields ()
  833. X{
  834. X    char    buf[BUFSIZ];
  835. X    char    *cp;
  836. X    long    value;
  837. X    struct    tm    *tp;
  838. X
  839. X    printf ("Enter the new value, or press return for the default\n\n");
  840. X
  841. X    sprintf (buf, "%ld", mindays);
  842. X    change_field (buf, "Minimum Password Age");
  843. X    if (((mindays = strtol (buf, &cp, 10)) == 0 && *cp) || mindays < -1)
  844. X        return 0;
  845. X
  846. X    sprintf (buf, "%ld", maxdays);
  847. X    change_field (buf, "Maximum Password Age");
  848. X    if (((maxdays = strtol (buf, &cp, 10)) == 0 && *cp) || maxdays < -1)
  849. X        return 0;
  850. X
  851. X    value = lastday * SCALE;
  852. X    tp = gmtime (&value);
  853. X    sprintf (buf, "%02d/%02d/%02d",
  854. X        tp->tm_mon + 1, tp->tm_mday, tp->tm_year);
  855. X    change_field (buf, "Last Password Change (MM/DD/YY)");
  856. X    if (strcmp (buf, "12/31/69") == 0)
  857. X        lastday = -1;
  858. X    else if ((lastday = strtoday (buf)) == -1)
  859. X        return 0;
  860. X
  861. X    sprintf (buf, "%ld", warndays);
  862. X    change_field (buf, "Password Expiration Warning");
  863. X    if (((warndays = strtol (buf, &cp, 10)) == 0 && *cp) || warndays < -1)
  864. X        return 0;
  865. X
  866. X    sprintf (buf, "%ld", inactdays);
  867. X    change_field (buf, "Password Inactive");
  868. X    if (((inactdays = strtol (buf, &cp, 10)) == 0 && *cp) || inactdays < -1)
  869. X        return 0;
  870. X
  871. X    value = expdays * SCALE;
  872. X    tp = gmtime (&value);
  873. X    sprintf (buf, "%02d/%02d/%02d",
  874. X        tp->tm_mon + 1, tp->tm_mday, tp->tm_year);
  875. X    change_field (buf, "Account Expiration Date (MM/DD/YY)");
  876. X    if (strcmp (buf, "12/31/69") == 0)
  877. X        expdays = -1;
  878. X    else if ((expdays = strtoday (buf)) == -1)
  879. X        return 0;
  880. X
  881. X    return 1;
  882. X}
  883. X
  884. X/*
  885. X * list_fields - display the current values of the expiration fields
  886. X *
  887. X * display the password age information from the password fields.  date
  888. X * values will be displayed as a calendar date, or the word "Never" if
  889. X * the date is 1/1/70, which is day number 0.
  890. X */
  891. X
  892. Xvoid
  893. Xlist_fields ()
  894. X{
  895. X    struct    tm    *tp;
  896. X    char    *cp;
  897. X    long    changed;
  898. X    long    expires;
  899. X
  900. X    /*
  901. X     * Start with the easy numbers - the number of days before the
  902. X     * password can be changed, the number of days after which the
  903. X     * password must be chaged, the number of days before the
  904. X     * password expires that the user is told, and the number of
  905. X     * days after the password expires that the account becomes
  906. X     * unusable.
  907. X     */
  908. X
  909. X    printf ("Minimum:\t%d\n", mindays);
  910. X    printf ("Maximum:\t%d\n", maxdays);
  911. X    printf ("Warning:\t%d\n", warndays);
  912. X    printf ("Inactive:\t%d\n", inactdays);
  913. X
  914. X    /*
  915. X     * The "last change" date is either "Never" or the date the
  916. X     * password was last modified.  The date is the number of
  917. X     * days since 1/1/1970.
  918. X     */
  919. X
  920. X    printf ("Last Change:\t\t");
  921. X    if (lastday <= 0) {
  922. X        printf ("Never\n");
  923. X    } else {
  924. X        changed = lastday * SCALE;
  925. X        tp = gmtime (&changed);
  926. X        cp = asctime (tp);
  927. X        printf ("%6.6s, %4.4s\n", cp + 4, cp + 20);
  928. X    }
  929. X
  930. X    /*
  931. X     * The password expiration date is determined from the last
  932. X     * change date plus the number of days the password is valid
  933. X     * for.
  934. X     */
  935. X
  936. X    printf ("Password Expires:\t");
  937. X    if (lastday <= 0 || maxdays >= 10000*(DAY/SCALE) || maxdays <= 0) {
  938. X        printf ("Never\n");
  939. X    } else {
  940. X        expires = changed + maxdays * SCALE;
  941. X        tp = gmtime (&expires);
  942. X        cp = asctime (tp);
  943. X        printf ("%6.6s, %4.4s\n", cp + 4, cp + 20);
  944. X    }
  945. X
  946. X    /*
  947. X     * The account becomes inactive if the password is expired
  948. X     * for more than "inactdays".  The expiration date is calculated
  949. X     * and the number of inactive days is added.  The resulting date
  950. X     * is when the active will be disabled.
  951. X     */
  952. X
  953. X    printf ("Password Inactive:\t");
  954. X    if (lastday <= 0 || inactdays <= 0 ||
  955. X            maxdays >= 10000*(DAY/SCALE) || maxdays <= 0) {
  956. X        printf ("Never\n");
  957. X    } else {
  958. X        expires = changed + (maxdays + inactdays) * SCALE;
  959. X        tp = gmtime (&expires);
  960. X        cp = asctime (tp);
  961. X        printf ("%6.6s, %4.4s\n", cp + 4, cp + 20);
  962. X    }
  963. X
  964. X    /*
  965. X     * The account will expire on the given date regardless of the
  966. X     * password expiring or not.
  967. X     */
  968. X
  969. X    printf ("Account Expires:\t");
  970. X    if (expdays <= 0) {
  971. X        printf ("Never\n");
  972. X    } else {
  973. X        expires = expdays * SCALE;
  974. X        tp = gmtime (&expires);
  975. X        cp = asctime (tp);
  976. X        printf ("%6.6s, %4.4s\n", cp + 4, cp + 20);
  977. X    }
  978. X}
  979. X
  980. X/*
  981. X * chage - change a user's password aging information
  982. X *
  983. X *    This command controls the password aging information.
  984. X *
  985. X *    The valid options are
  986. X *
  987. X *    -m    minimum number of days before password change (*)
  988. X *    -M    maximim number of days before password change (*)
  989. X *    -d    last password change date (*)
  990. X *    -l    last password change date
  991. X *    -W    expiration warning days (*)
  992. X *    -I    password inactive after expiration (*)
  993. X *    -E    account expiration date (*)
  994. X *
  995. X *    (*) requires root permission to execute.
  996. X *
  997. X *    All of the time fields are entered in the internal format
  998. X *    which is either seconds or days.
  999. X */
  1000. X
  1001. Xint
  1002. Xmain (argc, argv)
  1003. Xint    argc;
  1004. Xchar    **argv;
  1005. X{
  1006. X    int    flag;
  1007. X    int    lflg = 0;
  1008. X    int    mflg = 0;
  1009. X    int    Mflg = 0;
  1010. X    int    dflg = 0;
  1011. X    int    Wflg = 0;
  1012. X    int    Iflg = 0;
  1013. X    int    Eflg = 0;
  1014. X    int    ruid = getuid ();
  1015. X    struct    passwd    *pw;
  1016. X    struct    passwd    pwent;
  1017. X    struct    spwd    *sp;
  1018. X    struct    spwd    spwd;
  1019. X    char    name[BUFSIZ];
  1020. X
  1021. X    /*
  1022. X     * Get the program name so that error messages can use it.
  1023. X     */
  1024. X
  1025. X    if (Prog = strrchr (argv[0], '/'))
  1026. X        Prog++;
  1027. X    else
  1028. X        Prog = argv[0];
  1029. X
  1030. X#ifdef    USE_SYSLOG
  1031. X    openlog (Prog, LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_AUTH);
  1032. X#endif
  1033. X#ifdef    NDBM
  1034. X    sp_dbm_mode = O_RDWR;
  1035. X    pw_dbm_mode = O_RDWR;
  1036. X#endif
  1037. X
  1038. X    /*
  1039. X     * Parse the flags.  The difference between password file
  1040. X     * formats includes the number of fields, and whether the
  1041. X     * dates are entered as days or weeks.  Shadow password
  1042. X     * file info =must= be entered in days, while regular
  1043. X     * password file info =must= be entered in weeks.
  1044. X     */
  1045. X
  1046. X    while ((flag = getopt (argc, argv, "lm:M:W:I:E:d:")) != EOF) {
  1047. X        switch (flag) {
  1048. X            case 'l':
  1049. X                lflg++;
  1050. X                break;
  1051. X            case 'm':
  1052. X                mflg++;
  1053. X                mindays = strtol (optarg, 0, 10);
  1054. X                break;
  1055. X            case 'M':
  1056. X                Mflg++;
  1057. X                maxdays = strtol (optarg, 0, 10);
  1058. X                break;
  1059. X            case 'd':
  1060. X                dflg++;
  1061. X                lastday = strtol (optarg, 0, 10);
  1062. X                break;
  1063. X            case 'W':
  1064. X                Wflg++;
  1065. X                warndays = strtol (optarg, 0, 10);
  1066. X                break;
  1067. X            case 'I':
  1068. X                Iflg++;
  1069. X                inactdays = strtol (optarg, 0, 10);
  1070. X                break;
  1071. X            case 'E':
  1072. X                Eflg++;
  1073. X                expdays = strtol (optarg, 0, 10);
  1074. X                break;
  1075. X            default:
  1076. X                usage ();
  1077. X        }
  1078. X    }
  1079. X
  1080. X    /*
  1081. X     * Make certain the flags do not conflict and that there is
  1082. X     * a user name on the command line.
  1083. X     */
  1084. X
  1085. X    if (argc != optind + 1)
  1086. X        usage ();
  1087. X
  1088. X    if (lflg && (mflg || Mflg || dflg || Wflg || Iflg || Eflg)) {
  1089. X        fprintf (stderr, NO_LFLAG, Prog);
  1090. X#ifdef    USE_SYSLOG
  1091. X        closelog ();
  1092. X#endif
  1093. X        usage ();
  1094. X    }
  1095. X
  1096. X    /*
  1097. X     * An unprivileged user can ask for their own aging information,
  1098. X     * but only root can change it, or list another user's aging
  1099. X     * information.
  1100. X     */
  1101. X
  1102. X    if (ruid != 0 && ! lflg) {
  1103. X        fprintf (stderr, NO_PERM, Prog);
  1104. X#ifdef    USE_SYSLOG
  1105. X        closelog ();
  1106. X#endif
  1107. X        exit (1);
  1108. X    }
  1109. X
  1110. X    /*
  1111. X     * Lock and open the password file.  This loads all of the
  1112. X     * password file entries into memory.  Then we get a pointer
  1113. X     * to the password file entry for the requested user.
  1114. X     */
  1115. X
  1116. X    if (! pw_lock ()) {
  1117. X        fprintf (stderr, NO_PWLOCK, Prog);
  1118. X#ifdef    USE_SYSLOG
  1119. X        syslog (LOG_ERR, LOCK_FAIL, "/etc/passwd");
  1120. X        closelog ();
  1121. X#endif
  1122. X        exit (1);
  1123. X    }
  1124. X    if (! pw_open (ruid != 0 || lflg ? O_RDONLY:O_RDWR)) {
  1125. X        fprintf (stderr, NO_PWOPEN, Prog);
  1126. X        cleanup (1);
  1127. X#ifdef    USE_SYSLOG
  1128. X        syslog (LOG_ERR, OPEN_FAIL, "/etc/passwd");
  1129. X        closelog ();
  1130. X#endif
  1131. X        exit (1);
  1132. X    }
  1133. X    if (! (pw = pw_locate (argv[optind]))) {
  1134. X        fprintf (stderr, UNK_USER, Prog, argv[optind]);
  1135. X        cleanup (1);
  1136. X#ifdef    USE_SYSLOG
  1137. X        closelog ();
  1138. X#endif
  1139. X        exit (1);
  1140. X    }
  1141. X
  1142. X    /*
  1143. X     * For shadow password files we have to lock the file and
  1144. X     * read in the entries as was done for the password file.
  1145. X     * The user entries does not have to exist in this case;
  1146. X     * a new entry will be created for this user if one does
  1147. X     * not exist already.
  1148. X     */
  1149. X
  1150. X    if (! spw_lock ()) {
  1151. X        fprintf (stderr, NO_SPLOCK, Prog);
  1152. X        cleanup (1);
  1153. X#ifdef    USE_SYSLOG
  1154. X        syslog (LOG_ERR, LOCK_FAIL, "/etc/shadow");
  1155. X        closelog ();
  1156. X#endif
  1157. X        exit (1);
  1158. X    }
  1159. X    if (! spw_open ((ruid != 0 || lflg) ? O_RDONLY:O_RDWR)) {
  1160. X        fprintf (stderr, NO_SPOPEN, Prog);
  1161. X        cleanup (2);
  1162. X#ifdef    USE_SYSLOG
  1163. X        syslog (LOG_ERR, OPEN_FAIL, "/etc/shadow");
  1164. X        closelog ();
  1165. X#endif
  1166. X        exit (1);
  1167. X    }
  1168. X    if (sp = spw_locate (argv[optind]))
  1169. X        spwd = *sp;
  1170. X
  1171. X    strcpy (name, pw->pw_name);
  1172. X    pwent = *pw;
  1173. X
  1174. X    /*
  1175. X     * Set the fields that aren't being set from the command line
  1176. X     * from the password file.
  1177. X     */
  1178. X
  1179. X    if (sp) {
  1180. X        if (! Mflg)
  1181. X            maxdays = spwd.sp_max;
  1182. X        if (! mflg)
  1183. X            mindays = spwd.sp_min;
  1184. X        if (! dflg)
  1185. X            lastday = spwd.sp_lstchg;
  1186. X        if (! Wflg)
  1187. X            warndays = spwd.sp_warn;
  1188. X        if (! Iflg)
  1189. X            inactdays = spwd.sp_inact;
  1190. X        if (! Eflg)
  1191. X            expdays = spwd.sp_expire;
  1192. X    } else
  1193. X#ifdef    ATT_AGE
  1194. X    {
  1195. X        if (pwent.pw_age && strlen (pwent.pw_age) >= 2) {
  1196. X            if (! Mflg)
  1197. X                maxdays = c64i (pwent.pw_age[0]) * (WEEK/SCALE);
  1198. X            if (! mflg)
  1199. X                mindays = c64i (pwent.pw_age[1]) * (WEEK/SCALE);
  1200. X            if (! dflg && strlen (pwent.pw_age) == 4)
  1201. X                lastday = a64l (pwent.pw_age+2) * (WEEK/SCALE);
  1202. X        } else {
  1203. X            mindays = 0;
  1204. X            maxdays = 10000L * (DAY/SCALE);
  1205. X            lastday = -1;
  1206. X        }
  1207. X        warndays = inactdays = expdays = -1;
  1208. X    }
  1209. X#endif
  1210. X
  1211. X    /*
  1212. X     * Print out the expiration fields if the user has
  1213. X     * requested the list option.
  1214. X     */
  1215. X
  1216. X    if (lflg) {
  1217. X        if (ruid != 0 && ruid != pw->pw_uid) {
  1218. X            fprintf (stderr, NO_PERM, Prog);
  1219. X#ifdef    USE_SYSLOG
  1220. X            closelog ();
  1221. X#endif
  1222. X            exit (1);
  1223. X        }
  1224. X        list_fields ();
  1225. X        cleanup (2);
  1226. X#ifdef    USE_SYSLOG
  1227. X        closelog ();
  1228. X#endif
  1229. X        exit (0);
  1230. X    }
  1231. X
  1232. X    /*
  1233. X     * If none of the fields were changed from the command line,
  1234. X     * let the user interactively change them.
  1235. X     */
  1236. X
  1237. X    if (! mflg && ! Mflg && ! dflg && ! Wflg && ! Iflg && ! Eflg) {
  1238. X        printf (CHANGE_INFO, name);
  1239. X        if (! new_fields ()) {
  1240. X            fprintf (stderr, FIELD_ERR, Prog);
  1241. X            cleanup (2);
  1242. X#ifdef    USE_SYSLOG
  1243. X            closelog ();
  1244. X#endif
  1245. X            exit (1);
  1246. X        }
  1247. X    }
  1248. X
  1249. X    /*
  1250. X     * There was no shadow entry.  The new entry will have the
  1251. X     * encrypted password transferred from the normal password
  1252. X     * file along with the aging information.
  1253. X     */
  1254. X
  1255. X    if (sp == 0) {
  1256. X        sp = &spwd;
  1257. X        bzero (&spwd, sizeof spwd);
  1258. X
  1259. X        sp->sp_namp = pw->pw_name;
  1260. X        sp->sp_pwdp = pw->pw_passwd;
  1261. X        sp->sp_flag = -1;
  1262. X
  1263. X        pwent.pw_passwd = "!";
  1264. X#ifdef    ATT_AGE
  1265. X        pwent.pw_age = "";
  1266. X#endif
  1267. X        if (! pw_update (&pwent)) {
  1268. X            fprintf (stderr, NO_PWUPDATE, Prog);
  1269. X            cleanup (2);
  1270. X#ifdef    USE_SYSLOG
  1271. X            syslog (LOG_ERR, WRITE_FAIL, "/etc/passwd");
  1272. X            closelog ();
  1273. X#endif
  1274. X            exit (1);
  1275. X        }
  1276. X#if defined(DBM) || defined(NDBM)
  1277. X        (void) pw_dbm_update (&pwent);
  1278. X        endpwent ();
  1279. X#endif
  1280. X    }
  1281. X
  1282. X    /*
  1283. X     * Copy the fields back to the shadow file entry and
  1284. X     * write the modified entry back to the shadow file.
  1285. X     * Closing the shadow and password files will commit
  1286. X     * any changes that have been made.
  1287. X     */
  1288. X
  1289. X    sp->sp_max = maxdays;
  1290. X    sp->sp_min = mindays;
  1291. X    sp->sp_lstchg = lastday;
  1292. X    sp->sp_warn = warndays;
  1293. X    sp->sp_inact = inactdays;
  1294. X    sp->sp_expire = expdays;
  1295. X
  1296. X    if (! spw_update (sp)) {
  1297. X        fprintf (stderr, NO_SPUPDATE, Prog);
  1298. X        cleanup (2);
  1299. X#ifdef    USE_SYSLOG
  1300. X        syslog (LOG_ERR, WRITE_FAIL, "/etc/shadow");
  1301. X        closelog ();
  1302. X#endif
  1303. X        exit (1);
  1304. X    }
  1305. X#ifdef    NDBM
  1306. X
  1307. X    /*
  1308. X     * See if the shadow DBM file exists and try to update it.
  1309. X     */
  1310. X
  1311. X    if (access ("/etc/shadow.pag", 0) == 0 && ! sp_dbm_update (sp)) {
  1312. X        fprintf (stderr, DBMERROR);
  1313. X        cleanup (2);
  1314. X#ifdef    USE_SYSLOG
  1315. X        syslog (LOG_ERR, DBMERROR2);
  1316. X        closelog ();
  1317. X#endif
  1318. X        exit (1);
  1319. X    }
  1320. X    endspent ();
  1321. X#endif    /* NDBM */
  1322. X
  1323. X    /*
  1324. X     * Now close the shadow password file, which will cause all
  1325. X     * of the entries to be re-written.
  1326. X     */
  1327. X
  1328. X    if (! spw_close ()) {
  1329. X        fprintf (stderr, NO_SPCLOSE, Prog);
  1330. X        cleanup (2);
  1331. X#ifdef    USE_SYSLOG
  1332. X        syslog (LOG_ERR, CLOSE_FAIL, "/etc/shadow");
  1333. X        closelog ();
  1334. X#endif
  1335. X        exit (1);
  1336. X    }
  1337. X
  1338. X    /*
  1339. X     * Close the password file.  If any entries were modified, the
  1340. X     * file will be re-written.
  1341. X     */
  1342. X
  1343. X    if (! pw_close ()) {
  1344. X        fprintf (stderr, NO_PWCLOSE, Prog);
  1345. X        cleanup (2);
  1346. X#ifdef    USE_SYSLOG
  1347. X        syslog (LOG_ERR, CLOSE_FAIL, "/etc/passwd");
  1348. X        closelog ();
  1349. X#endif
  1350. X        exit (1);
  1351. X    }
  1352. X    cleanup (2);
  1353. X#ifdef    USE_SYSLOG
  1354. X    closelog ();
  1355. X#endif
  1356. X    exit (0);
  1357. X    /*NOTREACHED*/
  1358. X}
  1359. X
  1360. X/*
  1361. X * cleanup - unlock any locked password files
  1362. X */
  1363. X
  1364. Xvoid
  1365. Xcleanup (state)
  1366. Xint    state;
  1367. X{
  1368. X    switch (state) {
  1369. X        case 2:
  1370. X            spw_unlock ();
  1371. X        case 1:
  1372. X            pw_unlock ();
  1373. X        case 0:
  1374. X            break;
  1375. X    }
  1376. X}
  1377. END_OF_FILE
  1378.   if test 17397 -ne `wc -c <'chage.c'`; then
  1379.     echo shar: \"'chage.c'\" unpacked with wrong size!
  1380.   fi
  1381.   # end of 'chage.c'
  1382. fi
  1383. if test -f 'login.5' -a "${1}" != "-c" ; then 
  1384.   echo shar: Will not clobber existing file \"'login.5'\"
  1385. else
  1386.   echo shar: Extracting \"'login.5'\" \(13490 characters\)
  1387.   sed "s/^X//" >'login.5' <<'END_OF_FILE'
  1388. X.\" Copyright 1991, John F. Haugh II and Chip Rosenthal
  1389. X.\" All rights reserved.
  1390. X.\"
  1391. X.\" Permission is granted to copy and create derivative works for any
  1392. X.\" non-commercial purpose, provided this copyright notice is preserved
  1393. X.\" in all copies of source code, or included in human readable form
  1394. X.\" and conspicuously displayed on all copies of object code or
  1395. X.\" distribution media.
  1396. X.\"
  1397. X.\"    @(#)login.5    3.2    08:52:50    11/3/91
  1398. X.\"
  1399. X.TH LOGIN 5
  1400. X.SH NAME
  1401. X/etc/login.defs \- Login configuration
  1402. X.SH DESCRIPTION
  1403. XThe
  1404. X.I /etc/login.defs
  1405. Xfile defines the site-specific configuration for the shadow login
  1406. Xsuite.  This file is required.  Absence of this file will not prevent
  1407. Xsystem operation, but will probably result in undesirable operation.
  1408. X.PP
  1409. XThis file is a readable text file, each line of the file describing
  1410. Xone configuration parameter.  The lines consist of a configuration
  1411. Xname and value, seperated by whitespace.  Blank lines and comment
  1412. Xlines are ignored.  Comments are introduced with a `#' pound sign and
  1413. Xthe pound sign must be the first non-white character of the line.
  1414. X.PP
  1415. XParameter values may be of four types:  strings, booleans, numbers,
  1416. Xand long numbers.  A string is comprised of any printable characters.
  1417. XA boolean should be either the value ``yes'' or ``no''.  An undefined
  1418. Xboolean parameter or one with a value other than these will be given
  1419. Xa ``no'' value.  Numbers (both regular and long) may be either decimal
  1420. Xvalues, octal values (precede the value with ``0'') or hexadecimal
  1421. Xvalues (precede the value with ``0x'').  The maximum value of the
  1422. Xregular and long numeric parameters is machine-dependant.
  1423. X.PP
  1424. XThe following configuration items are provided:
  1425. X.\"
  1426. X.IP "CONSOLE (string)"
  1427. XIf specified, this definition provides for a restricted set of lines
  1428. Xon which root logins will be allowed.  An attempted root login which
  1429. Xdoes not meet the criteria established here will be rejected.  The
  1430. Xvalue of this field may be one of two forms, either a fully-rooted
  1431. Xpathname such as
  1432. X.sp
  1433. X.ft CW
  1434. X    CONSOLE /etc/consoles
  1435. X.ft P
  1436. X.sp
  1437. Xor a colon-delimited list of terminal lines such as:
  1438. X.sp
  1439. X.ft CW
  1440. X    CONSOLE console:tty01:tty02:tty03:tty04
  1441. X.ft P
  1442. X.sp
  1443. XIf a pathname is given, each line of the file should specify one
  1444. Xterminal line.  If this parameter is not defined or the specified file
  1445. Xdoes not exist, then root logins will be allowed from any terminal
  1446. Xline.  Because the removal of this file, or its truncation, could
  1447. Xresult in unauthorized root logins, this file must be protected.
  1448. XWhere security is critical, the colon-separated form should be used
  1449. Xto prevent this potential method of attack.
  1450. X.\"
  1451. X.IP "DIALUPS_CHECK_ENAB (boolean)"
  1452. XIf
  1453. X.I yes
  1454. Xand an
  1455. X.I /etc/dialups
  1456. Xfile exists, then secondary passwords are enabled upon the dialup
  1457. Xlines specified in this file.  This file should contain a list of
  1458. Xdialups, one per line, for example:
  1459. X.nf
  1460. X.sp
  1461. X.ft CW
  1462. X    ttyfm01
  1463. X    ttyfm02
  1464. X    \0\0.
  1465. X    \0\0.
  1466. X    \0\0.
  1467. X.ft P
  1468. X.sp
  1469. X.fi
  1470. X.\"
  1471. X.IP "ENV_HZ (string)"
  1472. XThis parameter specifies a value for an HZ environment parameter.
  1473. XExample usage is:
  1474. X.sp
  1475. X    \f(CWENV_HZ     HZ=50\fP
  1476. X.sp
  1477. XIf this parameter is not defined then no HZ value will be established.
  1478. X.\"
  1479. X.IP "ENV_PATH (string)"
  1480. XThis parameter must be defined as the search path for regular users.
  1481. XWhen a login with UID other than zero occurs, the PATH environment
  1482. Xparameter is initialized to this value.  This parameter is required;
  1483. Xif undefined a possibly incorrect default value will be provided.
  1484. X.\"
  1485. X.IP "ENV_SUPATH (string)"
  1486. XThis parameter must be defined as the search path for the superuser.
  1487. XWhen a login with UID zero occurs, the PATH environment parameter is
  1488. Xinitialized to this value.  This parameter is required; if undefined
  1489. Xa possibly incorrect default value will be provided.
  1490. X.\"
  1491. X.IP "ENV_TZ (string)"
  1492. XThis parameter specifies information for generating a TZ environment
  1493. Xparameter.  The value must either be the desired contents of TZ, or
  1494. Xthe full pathname of a file which contains this information.  Example
  1495. Xusage is:
  1496. X.sp
  1497. X    \f(CWENV_TZ\0\0\0\0TZ=CST6CDT\fP
  1498. X.sp
  1499. Xor
  1500. X.sp
  1501. X    \f(CWENV_TZ\0\0\0\0/etc/tzname\fP
  1502. X.sp
  1503. XIf a nonexistent file is named, then TZ will be initialized to some
  1504. Xdefault value.  If this parameter is not defined then no TZ value will
  1505. Xbe established.
  1506. X.\"
  1507. X.IP "ERASECHAR (number)"
  1508. XThe terminal
  1509. X.I erase
  1510. Xcharacter is initialized to this value.  This is supported only on
  1511. Xsystems with the
  1512. X.I termio
  1513. Xinterface, e.g. System V.  If not specified, the erase character will
  1514. Xbe initialized to a backspace.  See KILLCHAR for related information.
  1515. X.\"
  1516. X.IP "FAILLOG_ENAB (boolean)"
  1517. XIf
  1518. X.I yes
  1519. Xthen login failures will be accumulated in
  1520. X.I /usr/adm/faillog
  1521. Xin a
  1522. X.I faillog(8)
  1523. Xformat.
  1524. X.\"
  1525. X.IP "FTMP_FILE (string)"
  1526. XThis parameter specifies the full pathname to a file to which login
  1527. Xfailures are recorded.  When a login failure occurs, a
  1528. X.I utmp
  1529. Xformat record will be appended to this file.  Note that this differs
  1530. Xfrom the
  1531. X.I /usr/adm/faillog
  1532. Xfailure logging in that this facility logs every failure whereas the
  1533. X``faillog'' facility accumulates failure information per user.  If
  1534. Xthis parameter is not specified then logging will be inhibited.  See
  1535. XFAILLOG_ENAB and LOG_UNKFAIL_ENAB for related information.
  1536. X.\"
  1537. X.IP "HUSHLOGIN_FILE (string)"
  1538. XThis parameter is used to establish ``hushlogin'' conditions.  There
  1539. Xare two possible ways to establish these conditions.  First, if the
  1540. Xvalue of this parameter is a filename and that file exists in the
  1541. Xuser's home directory then ``hushlogin'' conditions will be in effect.
  1542. XThe contents of this file are ignored; its mere presence triggers
  1543. X``hushlogin'' conditions.  Second, if the value of this parameter is
  1544. Xa full pathname and either the user's login name or the user's shell
  1545. Xis found in this file, then ``hushlogin'' conditions will be in effect.
  1546. XIn this case, the file should be in a format similar to:
  1547. X.nf
  1548. X.sp
  1549. X.ft CW
  1550. X    demo
  1551. X    /usr/lib/uucp/uucico
  1552. X    \0\0.
  1553. X    \0\0.
  1554. X    \0\0.
  1555. X.ft P
  1556. X.sp
  1557. X.fi
  1558. XIf this parameter is not defined, then ``hushlogin'' conditions will
  1559. Xnever occur.  When ``hushlogin'' conditions are established, the
  1560. Xmessage of the day, last successful and unsuccessful login display,
  1561. Xmail status display, and password aging checks are suppressed.  Note
  1562. Xthat allowing hushlogin files in user home directories allows the user
  1563. Xto disable password aging checks.  See MOTD_FILE, FAILLOG_ENAB,
  1564. XLASTLOG_ENAB, and MAIL_CHECK_ENAB for related information.
  1565. X.\"
  1566. X.IP "KILLCHAR (number)"
  1567. XThe terminal
  1568. X.I kill
  1569. Xcharacter is initialized to this value.  This is supported only on
  1570. Xsystems with the
  1571. X.I termio
  1572. Xinterface, e.g. System V.  If not specified, the kill character will
  1573. Xbe initialized to a \s-2CTRL/U\s0.
  1574. XSee ERASECHAR for related information.
  1575. X.\"
  1576. X.IP "LASTLOG_ENAB (boolean)"
  1577. XIf
  1578. X.IR yes ,
  1579. Xand if the
  1580. X.I /usr/adm/lastlog
  1581. Xfile exists, then a successful user login will be recorded to this
  1582. Xfile.  Furthermore, if this option is enabled then the times of the
  1583. Xmost recent successful and unsuccessful logins will be displayed to
  1584. Xthe user upon login.  The unsuccessful login display will be suppressed
  1585. Xif FAILLOG_ENAB is not enabled.  If ``hushlogin'' conditions are in
  1586. Xeffect, then both the successful and unsuccessful login information
  1587. Xwill be suppressed.
  1588. X.\"
  1589. X.IP "LOG_UNKFAIL_ENAB (boolean)"
  1590. XIf
  1591. X.I yes
  1592. Xthen unknown usernames will be included when a login failure is
  1593. Xrecorded.  Note that this is a potential security risk; a common login
  1594. Xfailure mode is transposition of the user name and password, thus this
  1595. Xmode will often cause passwords to accumulate in the failure logs.
  1596. XIf this option is disabled then unknown usernames will be suppressed
  1597. Xin login failure messages.
  1598. X.\"
  1599. X.IP "MAIL_CHECK_ENAB (boolean)"
  1600. XIf
  1601. X.IR yes ,
  1602. Xthe user will be notified of his or her mailbox status upon login.
  1603. XSee MAIL_DIR for related information.
  1604. X.\"
  1605. X.IP "MAIL_DIR (string)"
  1606. XThis parameter specifies the full pathname to the directory which
  1607. Xcontains the user mailbox files.  The user's login name is appended
  1608. Xto this path to form the MAIL environment parameter \- the path to
  1609. Xthe user's mailbox.  This parameter must be defined; if undefined some
  1610. Xpossibly incorrect default value will be assumed.  See MAIL_CHECK_ENAB
  1611. Xfor related information.
  1612. X.\"
  1613. X.IP "MOTD_FILE (string)"
  1614. XThis parameter specifies a colon-delimited list of pathnames to ``message
  1615. Xof the day'' files.
  1616. XIf a specified file exists, then its contents are displayed to the user
  1617. Xupon login.
  1618. XIf this parameter is not defined or ``hushlogin'' login conditions are
  1619. Xin effect, this information will be suppressed.
  1620. X.\"
  1621. X.IP "NOLOGIN_STR (string)"
  1622. XThis parameter specifies a value which will prevent logins on particular
  1623. Xaccounts.  If this value is found in the ``shell'' field of a user's
  1624. X.I passwd
  1625. Xentry, then logins will not be allowed under that user name.  The
  1626. X.I su
  1627. Xcommand may still be used.  If this parameter is not specified then
  1628. Xthis feature will be suppressed.
  1629. X.\"
  1630. X.IP "NOLOGINS_FILE (string)"
  1631. XThis parameter specifies the full pathname to a file which inhibits
  1632. Xnon-root logins.  If this file exists and a user other than root
  1633. Xattempts to log in, the contents of the file will be displayed and
  1634. Xthe user will be disconnected.  If this parameter is not specified
  1635. Xthen this feature will be inhibited.
  1636. X.\"
  1637. X.IP "OBSCURE_CHECKS_ENAB (boolean)"
  1638. XIf
  1639. X.IR yes ,
  1640. Xthe
  1641. X.I passwd
  1642. Xprogram will perform additional checks before accepting a password change.
  1643. XThe checks performed are fairly simple, and their use is recommended.
  1644. XThese obscurity checks are bypassed if
  1645. X.I passwd
  1646. Xis run by
  1647. X.IR root .
  1648. XSee PASS_MIN_LEN for related information.
  1649. X.\"
  1650. X.IP "PASS_MIN_DAYS (number)"
  1651. XThe minimum number of days allowed between password changes.  Any password
  1652. Xchanges attempted sooner than this will be rejected.  If not specified, a
  1653. Xzero value will be assumed.
  1654. X.\"
  1655. X.IP "PASS_MIN_LEN (number)"
  1656. XThe minimum number of characters in an acceptable password.  An attempt to
  1657. Xassign a password with fewer characters will be rejected.  A zero value
  1658. Xsuppresses this check.  If not specified, a zero value will be assumed.
  1659. X.\"
  1660. X.IP "PASS_MAX_DAYS (number)"
  1661. XThe maximum number of days a password may be used.  If the password is
  1662. Xolder than this, then the account will be locked.  If not specified,
  1663. Xa large value will be assumed.
  1664. X.\"
  1665. X.IP "PASS_WARN_AGE (number)"
  1666. XThe number of days warning given before a password expires.  A zero means
  1667. Xwarning is given only upon the day of expiration, a negative value means
  1668. Xno warning is given.  If not specified, no warning will be provided.
  1669. X.IP "PORTTIME_CHECKS_ENAB (boolean)"
  1670. XIf
  1671. X.I yes
  1672. Xand an
  1673. X.I /etc/porttime
  1674. Xfile exists, that file will be consulted to ensure the user may login
  1675. Xat this time on the given line.
  1676. Xc.f. porttime(4)
  1677. X.\"
  1678. X.IP "QUOTAS_ENAB (boolean)"
  1679. XIf
  1680. X.I yes ,
  1681. Xthen the user's ``ulimit,'' ``umask,'' and ``niceness'' will be
  1682. Xinitialized to the values if specified in the
  1683. X.I gecos
  1684. Xfield of the
  1685. X.I passwd
  1686. Xfile.
  1687. Xc.f. passwd(4).
  1688. X.\"
  1689. X.IP "SULOG_FILE (string)"
  1690. XThis parameter specifies a full pathname of a file in which
  1691. X.I su
  1692. Xactivity is logged.
  1693. XIf this parameter is not specified, the logging is suppressed.
  1694. XBecause the
  1695. X.I su
  1696. Xcommand may be used when attempting to authenticate a password,
  1697. Xeither this option, or
  1698. X.I syslog
  1699. Xshould be used to note
  1700. X.I su
  1701. Xactivity.  See the SYSLOG_SU_ENAB option for related information.
  1702. X.\"
  1703. X.IP "SYSLOG_SU_ENAB (boolean)"
  1704. XIf
  1705. X.I yes
  1706. Xand
  1707. X.I login
  1708. Xwas compiled with
  1709. X.I syslog
  1710. Xsupport, then all
  1711. X.I su
  1712. Xactivity will be noted through the
  1713. X.I syslog
  1714. Xfacility.
  1715. XSee SULOG_FILE for related information.
  1716. X.\"
  1717. X.IP "TTYPERM (number)"
  1718. XThe login terminal permissions are initialized to this value.  Typical
  1719. Xvalues will be \f(CW0622\fP to permit others write access to the line
  1720. Xor \f(CW0600\fP to secure the line from other users.  If not specified,
  1721. Xthe terminal permissions will be initialized to \f(CW0622\fP.
  1722. X.\"
  1723. X.IP "TTYTYPE_FILE (string)"
  1724. XThis parameter specifies the full pathname to a file which maps terminal
  1725. Xlines to terminal types.  Each line of the file contains a terminal
  1726. Xtype and a terminal line, seperated by whitespace, for example:
  1727. X.nf
  1728. X.sp
  1729. X.ft CW
  1730. X    vt100\0    tty01
  1731. X    wyse60    tty02
  1732. X    \0\0.\0\0\0    \0\0.
  1733. X    \0\0.\0\0\0    \0\0.
  1734. X    \0\0.\0\0\0    \0\0.
  1735. X.ft P
  1736. X.sp
  1737. X.fi
  1738. XThis information is used to initialize the TERM environment parameter.
  1739. XA line starting with a ``#'' pound sign will be treated as a comment.
  1740. XIf this paramter is not specified, the file does not exist, or the terminal
  1741. Xline is not found in the file, then the TERM environment parameter will not
  1742. Xbe set.
  1743. X.\"
  1744. X.IP "ULIMIT (long number)"
  1745. XThe file size limit is initialized to this value.  This is supported
  1746. Xonly on systems with a
  1747. X.IR ulimit ,
  1748. Xe.g. System V.  If not specified, the file size limit will be initialized
  1749. Xto some large value.
  1750. X.\"
  1751. X.IP "UMASK (number)"
  1752. XThe permission mask is initialized to this value.  If not specified,
  1753. Xthe permission mask will be initialized to zero.
  1754. X.\"
  1755. X.SH CROSS REFERENCE
  1756. XThe following cross reference shows which programs in the shadow login
  1757. Xsuite use which parameters.
  1758. X.na
  1759. X.IP login 12
  1760. XCONSOLE DIALUPS_CHECK_ENAB ENV_HZ ENV_SUPATH ENV_TZ ERASECHAR FAILLOG_ENAB
  1761. XFTMP_FILE HUSHLOGIN_FILE KILLCHAR LASTLOG_ENAB LOG_UNKFAIL_ENAB
  1762. XMAIL_CHECK_ENAB MAIL_DIR MOTD_FILE NOLOGINS_FILE PORTTIME_CHECKS_ENAB
  1763. XQUOTAS_ENAB TTYPERM TTYTYPE_FILE ULIMIT UMASK
  1764. X.IP newusers 12
  1765. XPASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE UMASK
  1766. X.IP passwd 12
  1767. XOBSCURE_CHECKS_ENAB PASS_MIN_LEN
  1768. X.IP pwconv 12
  1769. XPASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE
  1770. X.IP su 12
  1771. XENV_HZ ENV_SUPATH ENV_TZ HUSHLOGIN_FILE MAIL_CHECK_ENAB MAIL_DIR
  1772. XMOTD_FILE NOLOGIN_STR QUOTAS_ENAB SULOG_FILE SYSLOG_SU_ENAB
  1773. X.IP sulogin 12
  1774. XENV_HZ ENV_SUPATH ENV_TZ MAIL_DIR QUOTAS_ENAB TTYPERM
  1775. X.ad
  1776. X.SH SEE ALSO
  1777. Xlogin(1), passwd(4), faillog(4), porttime(4), faillog(8)
  1778. END_OF_FILE
  1779.   if test 13490 -ne `wc -c <'login.5'`; then
  1780.     echo shar: \"'login.5'\" unpacked with wrong size!
  1781.   fi
  1782.   # end of 'login.5'
  1783. fi
  1784. if test -f 'passwd.1' -a "${1}" != "-c" ; then 
  1785.   echo shar: Will not clobber existing file \"'passwd.1'\"
  1786. else
  1787.   echo shar: Extracting \"'passwd.1'\" \(4116 characters\)
  1788.   sed "s/^X//" >'passwd.1' <<'END_OF_FILE'
  1789. X.\" Copyright 1989, 1990, John F. Haugh II
  1790. X.\" All rights reserved.
  1791. X.\"
  1792. X.\" Use, duplication, and disclosure prohibited without
  1793. X.\" the express written permission of the author.
  1794. X.\"
  1795. X.\"    @(#)passwd.1    3.1    09:34:23    11/21/90
  1796. X.\"
  1797. X.TH PASSWD 1
  1798. X.SH NAME
  1799. Xpasswd \- change user password
  1800. X.SH SYNOPSIS
  1801. X\fBpasswd\fR [ \fB-f\fR ] [ \fIname\fR ]
  1802. X.br
  1803. X\fBpasswd\fR [ \fB-g\fR ] [ \fB-r\fR ] \fIgroup\fR
  1804. X.SH DESCRIPTION
  1805. X\fIpasswd\f changes passwords for user accounts.
  1806. XA normal user may only change the password for their own account,
  1807. Xthe super user may change the password for any account.
  1808. X.PP
  1809. XThe user is first prompted for their old password,
  1810. Xif one is present.
  1811. XThis password is then encrypted and compared against the
  1812. Xstored password.
  1813. XThe user has only one chance to enter the correct password.
  1814. XThe super user is permitted to bypass this step so that forgotten
  1815. Xpasswords may be changed.
  1816. X.PP
  1817. XAfter the password has been entered password aging information
  1818. Xis checked to see if the user is permitted to change their password
  1819. Xat this time.
  1820. XIf not, \fIpasswd\fR refuses to change the password and exits.
  1821. X.PP
  1822. XThe user is then prompted for a replacement password.
  1823. XThis password is tested for complexity.
  1824. XAs a general guideline,
  1825. Xpasswords should consist of 6 to 8 characters including
  1826. Xone or more from each of following sets:
  1827. X.IP "" .5i
  1828. XLower case alphabetics
  1829. X.IP "" .5i
  1830. XUpper case alphabetics
  1831. X.IP "" .5i
  1832. XDigits 0 thru 9
  1833. X.IP "" .5i
  1834. XPunctuation marks
  1835. X.PP
  1836. XCare must be taken not to include the system default erase
  1837. Xor kill characters.
  1838. X\fIpasswd\fR will reject any password which is not suitably
  1839. Xcomplex.
  1840. X.PP
  1841. XIf the password is accepted,
  1842. X\fIpasswd\fR will prompt again and compare the second entry
  1843. Xagainst the first.
  1844. XBoth entries are require to match in order for the password
  1845. Xto be changed.
  1846. X.PP
  1847. XWhen the \fB-g\f option is used, the password for the named
  1848. Xgroup is changed.
  1849. XThe user must either be the super user, or the first group
  1850. Xmember listed for the named group.
  1851. XThe current group password is not prompted for.
  1852. XThe \fB-r\f option is used with the \fB-g\f option to remove
  1853. Xthe current password from the named group.
  1854. X.SH Hints for user passwords
  1855. XThe security of a password depends upon the strength of the
  1856. Xencryption algorithm and the size of the key space.
  1857. XThe \fB\s-2UNIX\s+2\fR System encryption method is based on
  1858. Xthe NBS DES algorithm and is very secure.
  1859. XThe size of the key space depends upon the randomness of the
  1860. Xpassword which is selected.
  1861. X.PP
  1862. XCompromises in password security normally result from careless
  1863. Xpassword selection or handling.
  1864. XFor this reason, you should select a password which does not
  1865. Xappear in a dictionary or which must be written down.
  1866. XThe password should also not be a proper name, your license
  1867. Xnumber, birth date, or street address.
  1868. XAny of these may be used as guesses to violate system security.
  1869. X.PP
  1870. XYour password must easily remembered so that you will not
  1871. Xbe forced to write it on a piece of paper.
  1872. XThis can be accomplished by appending two small words together
  1873. Xand separating each with a special character or digit.
  1874. XFor example, Pass%word.
  1875. X.PP
  1876. XOther methods of construction involve selecting an easily
  1877. Xremembered phrase from literature and selecting the first
  1878. Xor last letter from each.
  1879. XAn example of this is
  1880. X.IP "" .5i
  1881. XAsk not for whom the bell tolls.
  1882. X.PP
  1883. Xwhich produces
  1884. X.IP "" .5i
  1885. XAn4wtbt.
  1886. X.PP
  1887. XYou may be reasonably sure few crackers will have
  1888. Xincluded this in their dictionary.
  1889. X.SH Notes about group passwords
  1890. XGroup passwords are an inherent security problem since more
  1891. Xthan one person is permitted to know the password.
  1892. XHowever, groups are a useful tool for permitting co-operation
  1893. Xbetween different users.
  1894. X.SH CAVEATS
  1895. XNot all options may be supported.
  1896. XPassword complexity checking may vary from site to site.
  1897. XThe user is urged to select as complex a password as they
  1898. Xfeel comfortable with.
  1899. XA \fB-f\fR option exists to permit the superuser to override
  1900. Xany password complexity testing;
  1901. Xnormal users must create passwords which pass the complexity
  1902. Xtest.
  1903. X.SH Files
  1904. X/etc/passwd \- user account information
  1905. X.br
  1906. X/etc/shadow \- encrypted user passwords
  1907. X.SH See Also
  1908. Xpasswd(3),
  1909. Xshadow(3),
  1910. Xgroup(4),
  1911. Xpasswd(4)
  1912. END_OF_FILE
  1913.   if test 4116 -ne `wc -c <'passwd.1'`; then
  1914.     echo shar: \"'passwd.1'\" unpacked with wrong size!
  1915.   fi
  1916.   # end of 'passwd.1'
  1917. fi
  1918. echo shar: End of archive 3 \(of 11\).
  1919. cp /dev/null ark3isdone
  1920. MISSING=""
  1921. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1922.     if test ! -f ark${I}isdone ; then
  1923.     MISSING="${MISSING} ${I}"
  1924.     fi
  1925. done
  1926. if test "${MISSING}" = "" ; then
  1927.     echo You have unpacked all 11 archives.
  1928.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1929. else
  1930.     echo You still must unpack the following archives:
  1931.     echo "        " ${MISSING}
  1932. fi
  1933. exit 0
  1934. exit 0 # Just in case...
  1935.